package com.cn.onetrip.untility;

import java.io.File;

import com.cn.onetrip.activity.TripActivity;

import android.content.Context;
import android.net.ConnectivityManager;
import android.os.Environment;

public class HTTPUrl {

	public static String JsonTextFloder = "";
	
	public static String HistoryFloder = "";

	public static String ImageCacheFloder = "";

	public static String OfflinePackage = "";

	public static String OfflineFloder = "/ScenicGuideApp/OfflineFile/";

	public static boolean isInternet = true;

	public static String URL_DOMAIN_NAME = isInternet ? "http://tm.1trip.com"
			: "http://172.27.3.6:3000";

	public static String HTTP_CONTENT_URL = URL_DOMAIN_NAME + "/api/v2/eachs/";
	// + TripActivity.scenic_slug + ".json?edition=2";

	public static String HTTP_INFO_URL = URL_DOMAIN_NAME + "/api/v2/guides/";
	// + TripActivity.scenic_slug + ".json?edition=2";

	public static String HTTP_WEATHER_URL = URL_DOMAIN_NAME
			+ "/api/v2/weathers/";

	// + TripActivity.scenic_slug + ".json?edition=2";

	public static boolean CheckNetworkState(Context context) {
		boolean flag = false;
		ConnectivityManager manager = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		if (manager.getActiveNetworkInfo() != null) {
			flag = manager.getActiveNetworkInfo().isConnected();
		}
		return flag;
	}

	public static void deleteFile(File file) {
		if (file.exists()) {
			if (file.isFile()) {
				file.delete();
			} else if (file.isDirectory()) {
				File files[] = file.listFiles();
				for (int i = 0; i < files.length; i++) {
					deleteFile(files[i]);
				}
			}
			file.delete();
		}
	}
}
